package com.ray.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ray.service.FeedOrderService;
import com.ray.util.RequestUtil;
import com.ray.util.ResponseUtil;

/**
 * 投料单控制层
* <p>Title: FeedOrderController</p>  
* <p>Description: </p>  
* @author 李斌  
* @date 2018年10月11日
 */
@Controller
@RequestMapping("/feedOrder")
public class FeedOrderController {
	
	@Autowired
	FeedOrderService feedOrderService;
	
	@RequestMapping("/addOrderInfoDetail")
	@ResponseBody
	public Map<String,Object> addOrderInfoDetail(HttpServletRequest request){
		Map<String,String> map = RequestUtil.getRequestAllParam(request);
		feedOrderService.addOrderInfoDetail(map);
		return ResponseUtil.ResponseResult("新增成功");
	}
	
	/**
	 * 通过订单信息获取订单
	* @date 2018年10月11日 下午1:36:14 
	* @author 李斌
	* @return Map<String,Object> 
	* @throws
	 */
	@RequestMapping("/getOrderInfoDetailByDetail")
	@ResponseBody
	public Map<String,Object> getOrderInfoDetailByDetail(HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(feedOrderService.getOrderInfoDetailByDetail(map));
	}
	
	/**
	 * 修改订单明细信息
	* @date 2018年10月12日 下午2:36:39 
	* @author 李斌
	* @return Map<String,Object> 
	* @throws
	 */
	@RequestMapping("/updateOrderInfoDetail")
	@ResponseBody
	public Map<String,Object> updateOrderInfoDetail(HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request); 
		feedOrderService.updateOrderInfoDetail(map);
		return ResponseUtil.ResponseResult("提交修改物料申请成功");
	}
	
	/**
	 * 删除订单明细物料信息
	* @date 2018年10月17日 上午9:13:08 
	* @author 李斌
	* @return Map<String,Object> 
	* @throws
	 */
	@RequestMapping("/deleteOrderInfoDetail")
	@ResponseBody
	public Map<String,Object> deleteOrderInfoDetail(HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request); 
		feedOrderService.deleteOrderInfoDetail(map);
		return ResponseUtil.ResponseResult("删除成功");
	}
	
	/**
	 * 审核订单明细信息
	* @date 2018年10月19日 下午2:44:57 
	* @author 李斌
	* @return Map<String,Object> 
	* @throws
	 */
	@RequestMapping("/approvalOrderInfoDetail")
	@ResponseBody
	public Map<String,Object> approvalOrderInfoDetail(HttpServletRequest request,int status){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request);
		feedOrderService.updateOrderInfoDetailByStatus(map,status);
		return ResponseUtil.ResponseResult("操作成功");
	}
	
	/**
	 * 获取申请修改中的订单信息
	* @date 2018年10月20日 下午5:14:12 
	* @author 李斌
	* @return Map<String,Object> 
	* @throws
	 */
	@RequestMapping("/getOrderInfoDetailApply")
	@ResponseBody
	public Map<String,Object> getOrderInfoDetailApply(HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(feedOrderService.getOrderInfoDetailApply(map));
	}
	
	
}
